package com.genexus.search;
import org.textmining.text.extraction.WordExtractor;

import java.io.*;

public class TextMiningWordDocHandler implements IDocumentHandler
{
	public String getText(String filename)
	{
		try
		{
			InputStream is = new FileInputStream(filename);
			String bodyText = "";
			try
			{
				bodyText = new WordExtractor().extractText(is);
			}
			catch (Exception e)
			{
				System.out.println("Cannot extract text from a Word document" + e.getMessage());
			}
			is.close();
			return bodyText;
		}
		catch (IOException ex)
		{

		}
		return "";
	}

}
